<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
 <head>
  <meta http-equiv="content-type" content="text/html; charset=UTF-8">
  <title>Streams data from source file pointer, apply encoding and write to destfp</title>
<link media="all" rel="stylesheet" type="text/css" href="styles/03e73060321a0a848018724a6c83de7f-theme-base.css" />
<link media="all" rel="stylesheet" type="text/css" href="styles/03e73060321a0a848018724a6c83de7f-theme-medium.css" />

 </head>
 <body class="docs"><div class="navbar navbar-fixed-top">
  <div class="navbar-inner clearfix">
    <ul class="nav" style="width: 100%">
      <li style="float: left;"><a href="function.mailparse-rfc822-parse-addresses.html">« mailparse_rfc822_parse_addresses</a></li>
      <li style="float: right;"><a href="function.mailparse-uudecode-all.html">mailparse_uudecode_all »</a></li>
    </ul>
  </div>
</div>
<div id="breadcrumbs" class="clearfix">
  <ul class="breadcrumbs-container">
    <li><a href="index.html">PHP Manual</a></li>
    <li><a href="ref.mailparse.html">Mailparse 函数</a></li>
    <li>Streams data from source file pointer, apply encoding and write to destfp</li>
  </ul>
</div>
<div id="layout">
  <div id="layout-content"><div id="function.mailparse-stream-encode" class="refentry">
 <div class="refnamediv">
  <h1 class="refname">mailparse_stream_encode</h1>
  <p class="verinfo">(PECL mailparse &gt;= 0.9.0)</p><p class="refpurpose"><span class="refname">mailparse_stream_encode</span> &mdash; <span class="dc-title">
   Streams data from source file pointer, apply encoding and write to destfp 
  </span></p>

 </div>
 <div class="refsect1 description" id="refsect1-function.mailparse-stream-encode-description">
  <h3 class="title">说明</h3>
  <div class="methodsynopsis dc-description">
   <span class="methodname"><strong>mailparse_stream_encode</strong></span>(<span class="methodparam"><span class="type">resource</span> <code class="parameter">$sourcefp</code></span>, <span class="methodparam"><span class="type">resource</span> <code class="parameter">$destfp</code></span>, <span class="methodparam"><span class="type">string</span> <code class="parameter">$encoding</code></span>): <span class="type">bool</span></div>

  <p class="para rdfs-comment">
   Streams data from the source file pointer, apply 
   <code class="parameter">encoding</code> and write to the destination file pointer. 
  </p>
 </div>


 <div class="refsect1 parameters" id="refsect1-function.mailparse-stream-encode-parameters">
  <h3 class="title">参数</h3>
  <p class="para">
   <dl>
    
     <dt>
<code class="parameter">sourcefp</code></dt>

     <dd>

      <p class="para">
       A valid file handle. The file is streamed through the parser.
      </p>
     </dd>

    
    
     <dt>
<code class="parameter">destfp</code></dt>

     <dd>

      <p class="para">
       The destination file handle in which the encoded data will be written.
      </p>
     </dd>

    
    
     <dt>
<code class="parameter">encoding</code></dt>

     <dd>

      <p class="para">
       One of the character encodings supported by the
       <a href="ref.mbstring.html" class="link">mbstring</a> module.
      </p>
     </dd>

    
   </dl>

  </p>
 </div>


 <div class="refsect1 returnvalues" id="refsect1-function.mailparse-stream-encode-returnvalues">
  <h3 class="title">返回值</h3>
  <p class="para">
   成功时返回 <strong><code>true</code></strong>， 或者在失败时返回 <strong><code>false</code></strong>。
  </p>
 </div>


 <div class="refsect1 examples" id="refsect1-function.mailparse-stream-encode-examples">
  <h3 class="title">范例</h3>
  <p class="para">
   <div class="example" id="example-3019">
    <p><strong>示例 #1 <span class="function"><strong>mailparse_stream_encode()</strong></span> example</strong></p>
    <div class="example-contents">
<div class="phpcode"><code><span style="color: #000000">
<span style="color: #0000BB">&lt;?php<br /><br /></span><span style="color: #FF8000">//&nbsp;email.eml&nbsp;contents:&nbsp;hello,&nbsp;this&nbsp;is&nbsp;some&nbsp;text=hello.<br /></span><span style="color: #0000BB">$fp&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">fopen</span><span style="color: #007700">(</span><span style="color: #DD0000">'email.eml'</span><span style="color: #007700">,&nbsp;</span><span style="color: #DD0000">'r'</span><span style="color: #007700">);<br /><br /></span><span style="color: #0000BB">$dest&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">tmpfile</span><span style="color: #007700">();<br /><br /></span><span style="color: #0000BB">mailparse_stream_encode</span><span style="color: #007700">(</span><span style="color: #0000BB">$fp</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">$dest</span><span style="color: #007700">,&nbsp;</span><span style="color: #DD0000">"quoted-printable"</span><span style="color: #007700">);<br /><br /></span><span style="color: #0000BB">rewind</span><span style="color: #007700">(</span><span style="color: #0000BB">$dest</span><span style="color: #007700">);<br /><br /></span><span style="color: #FF8000">//&nbsp;Display&nbsp;new&nbsp;file&nbsp;contents<br /></span><span style="color: #0000BB">fpassthru</span><span style="color: #007700">(</span><span style="color: #0000BB">$dest</span><span style="color: #007700">);<br /><br /></span><span style="color: #0000BB">?&gt;</span>
</span>
</code></div>
    </div>

    <div class="example-contents"><p>以上例程会输出：</p></div>
    <div class="example-contents screen">
<div class="cdata"><pre>
hello, this is some text=3Dhello.
</pre></div>
    </div>
   </div>
  </p>
 </div>


</div></div></div></body></html>